<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
评论内容：<textarea name="content" id="content"></textarea>
<input type="button" value="评论" onclick="insert()">
</body>
<script type="text/javascript" src="/js/plugins/jquery/jquery.min.js"></script>
<script th:inline="javascript">
    function insert() {
        alert(1111);
        var content=$("#content").val();
        $.ajax({
            url:"/comment/addComment",
            dataType:"json",
            type:"post",
            data:{content:content,id:[[${id}]]},
            success:function (result) {
                if (result.code==200){
                    alert("评论成功");
                    location.href="/address/index";
                }else {
                    alert("评论失败")
                }
            },
            error:function () {
                alert("系统错误")
            }
        })
    }
</script>
</html>